# - Config file for the ScanMan package
# It defines the following variables:

#  ScanMan_BIN_DIR                      - location of ScanMan
#  ScanMan_VERSION                      - version of the binary
#  ScanMan_ConfigPackageLocation        - location of the configuration files (= ScanMan_DIR)
# Imported Targets:
#  ScanMan_BINS                         - all executables
#  ScanMan::ScanMan                     - executable target

@PACKAGE_INIT@
set(cfg_hint "The problem is most likely that the generation of ScanManConfig.cmake in ScanMan/CMakeLists.txt is not up-to-date.")
set(ScanMan_VERSION "@ScanMan_VERSION@")
message("-- Found ScanMan, Version ${ScanMan_VERSION}")
if(@set_check@)
	set_and_check(ScanMan_BIN_DIR "@PACKAGE_INSTALL_BIN_DIR@")
	set_and_check(ScanMan_ConfigPackageLocation "@PACKAGE_ConfigPackageLocation@")
	if (NOT PACKAGE_PREFIX_DIR STREQUAL "")
		message("-- Using 'ScanMan' from '${PACKAGE_PREFIX_DIR}'")
	endif()
else()
	set(ScanMan_BIN_DIR "@ScanManDirectory@")
	# check when find_package is used whether directory exists
	if(NOT EXISTS "${ScanMan_BIN_DIR}")
		message(FATAL_ERROR "ScanMan_BIN_DIR not found: ${ScanMan_BIN_DIR}"
							" ${cfg_hint}")
	endif()
	set_and_check(ScanMan_ConfigPackageLocation "@PACKAGE_ConfigPackageLocation@")
	message("-- Using 'ScanMan' from a build tree")
	if (NOT ScanMan_BIN_DIR STREQUAL "")
		message("\t binary dir.:         '${ScanMan_BIN_DIR}'")
	endif()
	if (NOT ScanMasterLibs_ConfigPackageLocation STREQUAL "")
		message("\t target import:       '${ScanMan_ConfigPackageLocation}/ScanManTargets.cmake'")
	endif()
	if (NOT ScanMan_ConfigPackageLocation STREQUAL "")
		message("\t package location:    '${ScanMan_ConfigPackageLocation}'")
	endif()
endif()

include(${ScanMan_ConfigPackageLocation}/ScanManTargets.cmake)
# check whether configuration file is still up to date
set(ScanMan_BINS @ScanMannamespace@ScanMan )
foreach(t ${ScanMan_BINS})
	if(NOT TARGET ${t})
		message(FATAL_ERROR "Expected target does not exist: '${t}'\n"
			" Note that targets are case sensitive."
			" ${cfg_hint}")
	endif()
endforeach()